x = "111111110000000"
n = int(input())
res = 0
while True:
if n % int(x, 2) == 0:
print(int(x, 2))
break
x = x[1:-1]
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <cmath>
#include <vector>
#include<stdio.h>
#include<string.h>
#include<bitset>
#include <map>
#include <unordered_map>
#include <stack>
#include <set>
using namespace std;
#define _CRT_SECURE_NO_WARNINGS
#define sobhi ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
#define mod 1000000007
#define PI 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
//*************************************************************************************//
#define ll long long
#define fixed(n) cout << fixed << setprecision(n);
#define test() ll t;cin>>t;while(t--)
#define v vector
#define so(vec) sort(vec.begin(), vec.end());
#define all(vec) vec.begin(), vec.end()
#define rall(x) (x).rbegin(), (x).rend()
#define sor(arr,n) sort(arr, arr+n);
#define for0(i,n) for (ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define i(l,n,s) for (ll i = l; i < n; i+=s)
#define j(l,n,s) for (ll j = l; j < n; j+=s)
#define ri(l,n,s) for (ll i = n; i >=l; i-=s)
#define rj(l,n,s) for (ll j = n; j >=l; j-=s)
const ll MAX = 1e5 + 7;
template <typename T> istream& operator>>(istream& in, vector <T>& a) { for (auto& i : a) in >> i; return in; }
template <typename T> ostream& operator<<(ostream& out, vector <T>& a) { for (auto& i : a) out << i << " "; return out; }
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string number = "0123456789";
v<ll>a[MAX];
bool vis[MAX];
ll c, d;
//void dfs(int node)
//{
// vis[node] = 1;
// i(0, adj[node].size(), 1)
// {
// int n = adj[node][i];
// if (!vis[n])dfs(n);
// }
//}
void dfs(int u)
{
vis[u] = 1;
for0(i, a[u].size())
{
ll x = a[u][i];
if (vis[x])
{
d = 1;
break;
}
else
{
c++;
dfs(x);
}
}
}
ll fact(ll n) {
if (n == 0 || n == 1)return n;
return n * fact(n - 1);
}
ll gcd(ll a, ll b) {
return ((b == 0) ? a : gcd(b, a % b));
}
int com(pair<int, int>& a, pair<int, int>& b) {
return a.second > b.second;
}
int main()
{
//freopen("flips.in", "r", stdin);
//freopen("output.txt", "w", stdout);
sobhi
ll n; cin >> n;
ll k = 1,tmp=1,ans=1;
while (n >= tmp)
{
if (n % tmp == 0)
ans = tmp;
k++;
tmp = (pow(2, k) - 1) * (pow(2, k - 1));
}
cout << ans;
return 0;
}
901A - Hashing Trees | 1283A - Minutes Before the New Year |
1654D - Potion Brewing Class | 1107B - Digital root |
25A - IQ test | 785A - Anton and Polyhedrons |
1542B - Plus and Multiply | 306A - Candies |
1651C - Fault-tolerant Network | 870A - Search for Pretty Integers |
1174A - Ehab Fails to Be Thanos | 1169A - Circle Metro |
780C - Andryusha and Colored Balloons | 1153A - Serval and Bus |
1487C - Minimum Ties | 1136A - Nastya Is Reading a Book |
1353B - Two Arrays And Swaps | 1490E - Accidental Victory |
1335A - Candies and Two Sisters | 96B - Lucky Numbers (easy) |
1151B - Dima and a Bad XOR | 1435B - A New Technique |
1633A - Div 7 | 268A - Games |
1062B - Math | 1294C - Product of Three Numbers |
749A - Bachgold Problem | 1486B - Eastern Exhibition |
1363A - Odd Selection | 131B - Opposites Attract |